//
// Created by YxMin on 2024/7/12.
//
#include <sys/timeb.h>
#include <easyx.h>
#include <tinycthread.h>
long long TimeMilliSecond()
{
    timeb now{};
    ftime(&now);
    return now.time*1000 + now.millitm;
}
bool in_rect(int x,int y,RECT r) {
    return r.left <= x && x <= r.right && r.top <= y && y <= r.bottom;
}
void ThreadSleepFor(long long ms) {
    long long callTimePoint = TimeMilliSecond();
    while(TimeMilliSecond() - callTimePoint < ms) {
        thrd_yield();
    }
}